import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import fire from '@dfeidao/atom-web/msg/fire';
export default async function a008(fd: IFeidaoAiBrowserComponent, e: Event) {
	// todo
	const no = e.currentTarget as HTMLElement;
	const flags = no.getAttribute('flags');
	let knowledge_no;
	if (flags === '2') {
		// 技术
		const tdel = fd.data.node.querySelectorAll('[data-id="t_del"]:checked');
		if (tdel.length > 0) {
			const del = Array.from(tdel) as HTMLInputElement[];
			const arrt = del.map((n) => {
				return n.getAttribute('data-tno');
			});
			const nos = arrt as string[];
			knowledge_no = nos;
			fire('zj-000006', 'a001', knowledge_no, flags);
		} else {
			alert('请先选择要删除的数据');
			return;
		}

	} if (flags === '3') {
		// 商务

		const bdel = fd.data.node.querySelectorAll('[data-id="b_del"]:checked');
		if (bdel.length > 0) {
			const delb = Array.from(bdel) as HTMLInputElement[];
			const arrb = delb.map((n) => {
				return n.getAttribute('data-bno');
			});
			const nos = arrb as string[];
			knowledge_no = nos;
			fire('zj-000006', 'a001', knowledge_no, flags);
		} else {
			alert('请先选择要删除的数据');
			return;
		}

	} if (flags === '4') {
		// //自定义
		const udel = fd.data.node.querySelectorAll('[data-id="u_del"]:checked');
		if (udel.length > 0) {
			const delu = Array.from(udel) as HTMLInputElement[];
			const arrb = delu.map((n) => {
				return n.getAttribute('data-uno');
			});
			const nos = arrb as string[];
			knowledge_no = nos;
			fire('zj-000006', 'a001', knowledge_no, flags);
		} else {
			alert('请先选择要删除的数据');
			return;
		}


	}
}
